import { getToken, setToken, removeToken } from '@/utils/storage'
// import { login as loginapi } from '@/api/user'
const state = {
  username: {},
  token: getToken()

}
const mutations = {
  updataToken (state, token) {
    // console.log(token)
    state.token = token
    setToken(token)
  },
  username1 (state, payload) {
    state.username = payload
    // console.log(state.username)
  },
  delToken (state) {
    state.token = null
    removeToken()
  }

}
const actions = {
  deltlken ({ commit }) {
    commit('delToken')
    commit('username1', {})
  }

}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
